import request from "@/util/request";

/**
 * 删除用户访问令牌
 *
 * @param params 用于删除操作的参数
 * @returns 返回一个Promise对象，包含请求的结果
 */
export function deleteUserAccessToken(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/delete/' + params,
        method: 'post',
    });
}

export function getMe() {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getMe',
        method: 'get'
    })
}

/**
 * 第三方登录
 * @param params
 */
export function loginByThirdParty(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/render',
        method: 'post',
        params
    })
}

/**
 * 密码登录
 * @param params
 */
export function loginByPassword(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/auth/login',
        method: 'post',
        data: params
    });
}

/**
 * 本地注册
 * @param params
 */
export function localRegister(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/auth/register',
        method: 'post',
        data: params
    });
}

export function authVerify(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/verify/' + params,
        method: 'get',
    })
}

export function getUserByUid(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getUserByUid',
        method: 'get',
        params
    })
}

export function getUserCenterByUid(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getUserCenterByUid',
        method: 'get',
        params
    })
}

export function getSignDataByUserUid(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/signDataByUserUid',
        method: 'get',
        params
    })
}

export function retroactive(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/retroactive',
        method: 'post',
        data: params
    })
}

export function getCurrentUserCredits(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getCurrentUserCredits',
        method: 'post',
        params
    })
}

export function userSignIn() {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/userSignIn',
        method: 'post'
    })
}

export function getUserList(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + "/about/getUserList",
        method: 'post',
        data: params
    })
}

export function report(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/report/submit',
        method: 'post',
        data: params
    })
}

export function addUserWatch(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/addUserWatch',
        method: 'post',
        data: params
    })
}

export function deleteUserWatch(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/deleteUserWatch',
        method: 'post',
        data: params
    })
}

export function getBlogListByUser(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getBlogListByUser',
        method: 'post',
        data: params
    })
}

export function getQuestionListByUser(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getQuestionListByUser',
        method: 'post',
        data: params
    })
}

export function getUserWatchList(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/getUserWatchList',
        method: 'post',
        data: params
    })
}

//判断当前登录用户，是否关注过某人
export function checkCurrentUserWatch(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/about/checkCurrentUserWatch',
        method: 'post',
        data: params
    })
}

export function getCurrentUserAmount() {
    return request({
        url: import.meta.env.VITE_WEB_API + "/about/getCurrentUserAmount",
        method: 'post'
    })
}

export function editUser(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/editUser',
        method: 'post',
        data: params
    })
}

export function replyBlogLink(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/replyBlogLink',
        method: 'post',
        data: params
    });
}

/**
 * 更新用户密码
 * @param params
 */
export function updateUserPwd(params: any) {
    return request({
        url: import.meta.env.VITE_WEB_API + '/oauth/updateUserPwd',
        method: 'post',
        data: params
    });
}
